import request from '@/utils/request'

// 查询销售单详情列表
export function listSellOrderDetail(query) {
  return request({
    url: '/sell/sellOrderDetail/list',
    method: 'get',
    params: query
  })
}

// 查询销售单详情详细
export function getSellOrderDetail(id) {
  return request({
    url: '/sell/sellOrderDetail/' + id,
    method: 'get'
  })
}

// 新增销售单详情
export function addSellOrderDetail(data) {
  return request({
    url: '/sell/sellOrderDetail',
    method: 'post',
    data: data
  })
}

// 修改销售单详情
export function updateSellOrderDetail(data) {
  return request({
    url: '/sell/sellOrderDetail',
    method: 'put',
    data: data
  })
}

// 删除销售单详情
export function delSellOrderDetail(id) {
  return request({
    url: '/sell/sellOrderDetail/' + id,
    method: 'delete'
  })
}

export function handleReceipt(id) {
  return request({
    url: `/sell/sellOrderDetail/delivery`,
    method: 'put',
    data: {
      id
    }
  })
}

export function getOrderCount() {
  return request({
    url: `/sell/sellOrderDetail/count`,
    method: 'get'
  })
}

export function cancelOrder(id) {
  return request({
    url: `/sell/sellOrderDetail/cancel`,
    method: 'put',
    data: {id}
  })
}
